#ifndef YZJTHREAD_H
#define YZJTHREAD_H

#include "yzjreader.h"
#include "yzjwriter.h"
#include "abnormalcompute.h"
#include "yzjfile.h"
#include "servermonitor.h"

#include <QTreeWidget>

#include <pthread.h>

class YZJThread
{
public:
    YZJThread();
    ~YZJThread();
    void RunWrite();
    void RunRead(QTreeWidget *tw);

private:
    static void *computeFunction(void *arg);
    static void *readFunction(void *arg);
    static void *writeFunction(void *arg);

    pthread_t writeThread;
    pthread_t readThread;

    static pthread_mutex_t mutex;

//    static YzjWriter oWriter; // 已经将主机数据收集到QMultiMap中
//    static AbnormalCompute oComputor;
//    static YZJFile oFile;
//    static ServerMonitor oMonitor;

    static QFile file;
    int err;
};

pthread_mutex_t YZJThread::mutex = PTHREAD_MUTEX_INITIALIZER;
QFile YZJThread::file;

//YzjWriter YZJThread::oWriter;
//ServerMonitor YZJThread::oMonitor;
//AbnormalCompute YZJThread::oComputor;
//YZJFile YZJThread::oFile;

#endif // YZJTHREAD_H
